#include "cardcontrol.h"

int CardControl::getStatus() const
{
    return status;
}

int CardControl::changeStatus()
{
    if(from == to && status == RUN){
        status = WAIT2;
    }

    if(from == to && status == WAIT1){
        status = ARRIVED;
    }

    if(WAIT2 == status){
        status = WAIT1;
    }

    if(from < to && WAIT1 == status){
        status = RUN;
    }

    return status;
}

int CardControl::getFrom() const
{
    return from;
}

int CardControl::changePosi()
{
    if(RUN == status && from < to){
        from ++;
    }
    return from;
}

Card *CardControl::getCard() const
{
    return card;
}

int CardControl::getTo() const
{
    return to;
}

void CardControl::setStatus(int value)
{
    status = value;
}

CardControl::CardControl()
{
    
}

CardControl::CardControl(int f, int t, Card *c, int s)
{
    from = f;
    to = t;
    card = c;
    status = s;
}
